<template>
    <div class="user-main">
        <div class="user">
            <div class="user-headers">
                <div class="header-avatar">
                    <img src="https://thirdwx.qlogo.cn/mmopen/vi_32/GQp8bndH8SwAGhJYHPQ147ziaOV7Kv8C8HfLv5cOMwr0pW0kI1MTbdKcgRJ6m5XlDzKU2ShJNM50PLnjLf1arIA/132" alt="">
                </div>
                <div class="header-detail">
                    <div class="detail-name">花非花雾非雾.</div>
                    <div class="detail-vip">普通用户</div>
                </div>
                <div class="header-setting">
                    <i class="fa fa-cog"></i>
                </div>
            </div>
            <div class="user-bodys">
                <div class="user-num">
                    <div class="number">1</div>
                    <div class="title">报告</div>
                </div>
                <div class="user-num">
                    <div class="number">3</div>
                    <div class="title">就诊人</div>
                </div>
                <div class="user-num">
                    <div class="number">10</div>
                    <div class="title">积分</div>
                </div>
                <div class="user-num">
                    <div class="number">20.00</div>
                    <div class="title" @click="logout()">余额</div>
                </div>
            </div>
        </div>
        <div class="user-items">
<!--            <div class="body-item">-->
<!--                <div class="body-item-title">我的服务</div>-->
<!--                <van-grid :border="false" :column-num="4">-->
<!--                    <van-grid-item>-->
<!--                        <img src="../../assets/img/cang.png" alt="">-->
<!--                        <span prop="text">我的收藏</span>-->
<!--                    </van-grid-item>-->
<!--                    <van-grid-item>-->
<!--                        <img src="../../assets/img/kefu.png" alt="">-->
<!--                        <span prop="text">客服中心</span>-->
<!--                    </van-grid-item>-->
<!--                    <van-grid-item>-->
<!--                        <img src="../../assets/img/yijian.png" alt="">-->
<!--                        <span prop="text">意见反馈</span>-->
<!--                    </van-grid-item>-->
<!--                    <van-grid-item>-->
<!--                        <img src="../../assets/img/about.png" alt="">-->
<!--                        <span prop="text">关于我们</span>-->
<!--                    </van-grid-item>-->
<!--                    <van-grid-item>-->
<!--                        <img src="../../assets/img/bang.png" alt="">-->
<!--                        <span prop="text">帮助手册</span>-->
<!--                    </van-grid-item>-->
<!--                </van-grid>-->
<!--            </div>-->
<!--            <div class="body-item">-->
<!--                <div class="body-item-title">我的订单</div>-->
<!--                <van-grid :border="false" :column-num="4">-->
<!--                    <van-grid-item icon="fa fa-plus" text="文字" />-->
<!--                    <van-grid-item icon="fa fa-home" text="文字" />-->
<!--                    <van-grid-item icon="photo-o" text="文字" />-->
<!--                    <van-grid-item icon="photo-o" text="文字" />-->
<!--                </van-grid>-->
<!--            </div>-->
            <div class="body-item">
                <div class="body-item-title">医疗服务</div>
                <van-grid :border="false" :column-num="4">
                    <van-grid-item>
                        <img src="../../assets/img/bao.png" alt="">
                        <span prop="text">我的报告</span>
                    </van-grid-item>
                    <van-grid-item>
                        <img src="../../assets/img/zhen.png" alt="">
                        <span prop="text">我的问诊</span>
                    </van-grid-item>
                </van-grid>
            </div>
            <div class="body-item">
                <div @click="login()" class="body-item-title">健康管家</div>
                <van-grid :border="false" :column-num="4">
                    <van-grid-item @click="page('Member')">
                        <img src="../../assets/img/yijian.png" alt="">
                        <span prop="text">健康档案</span>
                    </van-grid-item>
                    <van-grid-item @click="page('Group')">
                        <img src="../../assets/img/kefu.png" alt="">
                        <span prop="text">档案分组</span>
                    </van-grid-item>
                </van-grid>
            </div>
<!--            <div class="body-item"></div>-->
        </div>
    </div>
</template>

<script>
import {UserLogin,UserMain,UserLogout} from '@/utils/request';
import { Dialog } from 'vant';
export default {
    data() {
        return {
            user: {},
            form: {
                openid: 'orkdl5xNZMgYN3IYu2Lc1AD_o_Mh'
            },
        }
    },
    created() {
        this.$store.dispatch('setActive', 4);
    },
    methods: {
        page(name){
            this.$router.push({name:name});
        },
        login(){
            UserLogin(this.form).then((res) =>{
                if(res.code){
                    Dialog.alert({
                        message: res.msg,
                        confirmButtonText: '知道了'
                    });
                }else{
                    this.$store.dispatch('userLogin',res.data).then(()=>{
                        console.log(res.data);
                    });
                }
            });
        },
    }
}
</script>

<style scoped>
.user-header {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 10000;
    line-height: 44px;
    padding: 0 10px;
    color: #252525;
    background: #fff;
    border-bottom: 1px solid #dcdcdc;
}
</style>
